package com.qiaoba.api.system.entity.dto;

import cn.hutool.core.lang.RegexPool;
import com.qiaoba.common.base.validate.AddGroup;
import com.qiaoba.common.base.validate.EditGroup;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.Set;

/**
 * 用户 DTO
 *
 * @author ailanyin
 * @date 2023-09-13 20:24:29
 */
@Data
public class SysUserDTO implements Serializable {

    @Schema(description = "用户ID")
    @NotNull(message = "用户ID不能为空", groups = {EditGroup.class})
    @Size(max = 20, message = "用户ID不能超过{max}个字符", groups = {EditGroup.class})
    private String userId;

    @Schema(description = "用户昵称")
    @NotBlank(message = "用户昵称不能为空", groups = {AddGroup.class, EditGroup.class})
    @Size(max = 30, message = "用户昵称不能超过{max}个字符", groups = {AddGroup.class, EditGroup.class})
    private String nickname;

    @Schema(description = "部门ID")
    private String deptId;

    @Schema(description = "手机号")
    @Pattern(regexp = RegexPool.MOBILE, message = "手机号不合法", groups = {AddGroup.class, EditGroup.class})
    private String phone;

    @Schema(description = "邮箱")
    @Pattern(regexp = RegexPool.EMAIL, message = "邮箱不合法", groups = {AddGroup.class, EditGroup.class})
    private String email;

    @Schema(description = "登陆账号")
    @NotBlank(message = "登陆账号不能为空", groups = {AddGroup.class})
    @Size(min = 6, max = 20, message = "账号长度{min}-{max}之间", groups = {AddGroup.class})
    private String username;

    @Schema(description = "密码")
    @NotBlank(message = "密码不能为空", groups = {AddGroup.class})
    @Size(min = 6, max = 20, message = "密码长度{min}-{max}之间", groups = {AddGroup.class})
    private String password;

    @Schema(description = "性别(0男 1女 2未知)")
    private String gender;

    @Schema(description = "帐号状态(1正常 0停用)")
    private String status;

    @Schema(description = "用户类型(1系统用户)")
    private String userType;

    @Schema(description = "角色(数组)")
    private Set<String> roleIds;

    @Schema(description = "岗位(数组)")
    private Set<String> postIds;

    @Schema(description = "备注")
    @Size(max = 500, message = "备注不能超过{max}个字符", groups = {AddGroup.class, EditGroup.class})
    private String remark;
}
